// src.util.jsonUtil.js

module.exports = {
    jsonWrite:function (req, result) {  // 返回JSON
        if (typeof result === 'undefined' || result == null) {
            req.json({
                status: 1,
                message: '操作失败'
            });
        } else if (result.length === 0) {
            req.json({
                status: 2,
                message: '请求成功无数据',
                result:[]
            });
        }
        else {
            req.json({
                status: 0,
                message: '请求成功',
                result: result
            });
        }
    }
}